home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Developer Essentials / DTS Sample Code / Macintosh Sample Code / SC.011.GetZoneList / GetZoneList.r < prev    next >
Encoding:
Text File  |  1992-06-10  |  6.6 KB  |  303 lines  |  [TEXT/MPS ]

  1. /*-----------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    AppleTalk GetZoneList Sample Application
  6. #
  7. #    GetZoneList
  8. #
  9. #    GetZoneList.r    -    Rez Source
  10. #
  11. #    Copyright © 1988-1990 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.00                November 1988
  15. #                1.01                October 1989
  16. #                1.02                May 1990
  17. #                1.03                June 1992
  18. #
  19. #    Components:    GetZoneList.c        May 1, 1990
  20. #                GetZoneList.p        May 1, 1990
  21. #                GetZoneList.r        May 1, 1990
  22. #                MakeFile            May 1, 1990
  23. #                UFailure.a            November 1, 1988
  24. #                UFailure.h            November 1, 1988
  25. #                UFailure.inc1.p        November 1, 1988
  26. #                UFailure.p            November 1, 1988
  27. #
  28. #    GetZoneList is a sample application that uses
  29. #    AppleTalk ATP and ZIP to obtain a list of zones
  30. #    on an AppleTalk internet.
  31. #
  32. #    GetZoneList also demonstrates using a signal, or
  33. #    failure-catching mechanism to recover from error
  34. #    situations.
  35. #
  36. #    GetZoneList is based on DTS Sample.p. For more
  37. #    description and explanantion of the non-example
  38. #    specific areas of this application, please refer to
  39. #    either Sample.p or TESample.p.
  40. #
  41. # -----------------------------------------------------------------------------*/
  42.  
  43. #include "Types.r"
  44.  
  45.  
  46. #define kMinSize    62        /* application's minimum size (in K) */
  47. #define kPrefSize    66        /* application's preferred size (in K) */
  48.  
  49. #define    rAboutAlert    128        /* about alert */
  50. #define rZoneDialog    129        /* zone list dialog */
  51. #define rUserAlert    130        /* error alert */
  52.  
  53. #define    sErrStrings    128        /* error strings STR# ID */
  54.  
  55. #define    rMenuBar    128        /* application's menu bar */
  56.  
  57. #define    mApple        128        /* Apple menu */
  58.  
  59. #define    mFile        129        /* File menu */
  60.  
  61. #define    mEdit        130        /* Edit menu */
  62.  
  63. /* these #defines are used to set enable/disable flags of a menu */
  64.  
  65. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  66. #define NoItems        0b0000000000000000000000000000000
  67. #define MenuItem1    0b0000000000000000000000000000001
  68. #define MenuItem2    0b0000000000000000000000000000010
  69. #define MenuItem3    0b0000000000000000000000000000100
  70. #define MenuItem4    0b0000000000000000000000000001000
  71. #define MenuItem5    0b0000000000000000000000000010000
  72. #define MenuItem6    0b0000000000000000000000000100000
  73. #define MenuItem7    0b0000000000000000000000001000000
  74. #define MenuItem8    0b0000000000000000000000010000000
  75. #define MenuItem9    0b0000000000000000000000100000000
  76. #define MenuItem10    0b0000000000000000000001000000000
  77. #define MenuItem11    0b0000000000000000000010000000000
  78. #define MenuItem12    0b0000000000000000000100000000000
  79.  
  80.  
  81. /* we use an MBAR resource to conveniently load all the menus */
  82.  
  83. resource 'MBAR' (rMenuBar, preload) {
  84.     { mApple, mFile, mEdit };    /* three menus */
  85. };
  86.  
  87.  
  88. resource 'MENU' (mApple, preload) {
  89.     mApple, textMenuProc,
  90.     AllItems & ~MenuItem2,        /* Disable dashed line, enable About and DAs */
  91.     enabled, apple,
  92.     {
  93.         "About GetZoneList…",
  94.             noicon, nokey, nomark, plain;
  95.         "-",
  96.             noicon, nokey, nomark, plain
  97.     }
  98. };
  99.  
  100. resource 'MENU' (mFile, preload) {
  101.     mFile, textMenuProc,
  102.     MenuItem1 | MenuItem12,        /* enable Quit and New only, program enables others */
  103.     enabled, "File",
  104.     {
  105.         "New",
  106.             noicon, "N", nomark, plain;
  107.         "Open",
  108.             noicon, "O", nomark, plain;
  109.         "-",
  110.             noicon, nokey, nomark, plain;
  111.         "Close",
  112.             noicon, "W", nomark, plain;
  113.         "Save",
  114.             noicon, "S", nomark, plain;
  115.         "Save As…",
  116.             noicon, nokey, nomark, plain;
  117.         "Revert",
  118.             noicon, nokey, nomark, plain;
  119.         "-",
  120.             noicon, nokey, nomark, plain;
  121.         "Page Setup…",
  122.             noicon, nokey, nomark, plain;
  123.         "Print…",
  124.             noicon, nokey, nomark, plain;
  125.         "-",
  126.             noicon, nokey, nomark, plain;
  127.         "Quit",
  128.             noicon, "Q", nomark, plain
  129.     }
  130. };
  131.  
  132. resource 'MENU' (mEdit, preload) {
  133.     mEdit, textMenuProc,
  134.     NoItems,                    /* disable everything, program does the enabling */
  135.     enabled, "Edit",
  136.      {
  137.         "Undo",
  138.             noicon, "Z", nomark, plain;
  139.         "-",
  140.             noicon, nokey, nomark, plain;
  141.         "Cut",
  142.             noicon, "X", nomark, plain;
  143.         "Copy",
  144.             noicon, "C", nomark, plain;
  145.         "Paste",
  146.             noicon, "V", nomark, plain;
  147.         "Clear",
  148.             noicon, nokey, nomark, plain
  149.     }
  150. };
  151.  
  152. /* this ALRT and DITL are used as an About screen */
  153.  
  154. resource 'ALRT' (rAboutAlert) {
  155.     {40, 20, 160, 292}, rAboutAlert, {
  156.         OK, visible, silent;
  157.         OK, visible, silent;
  158.         OK, visible, silent;
  159.         OK, visible, silent
  160.     };
  161. };
  162.  
  163. resource 'DITL' (rAboutAlert) {
  164.      {
  165.         {88, 180, 108, 260},
  166.         Button {
  167.             enabled,    "OK"
  168.         };
  169.         {8, 8, 24, 214},
  170.         StaticText {
  171.             disabled,    "GetZoneList"
  172.         };
  173.         {32, 8, 48, 237},
  174.         StaticText {
  175.             disabled,    "© 1989-90 Apple Computer, Inc."
  176.         };
  177.         {56, 8, 72, 136},
  178.         StaticText {
  179.             disabled,    "Brought to you by:"
  180.         };
  181.         {80, 24, 112, 167},
  182.         StaticText {
  183.             disabled,    "Macintosh Developer " $"CA" "Technical Support"
  184.         }
  185.     }
  186. };
  187.  
  188.  
  189. /* this DLOG and DITL are used for the Zone List dialog */
  190.  
  191. resource 'DLOG' (rZoneDialog) {
  192.     {100, 100, 290, 400},
  193.     dBoxProc,
  194.     invisible,
  195.     noGoAway,
  196.     0x0,
  197.     rZoneDialog,
  198.     ""
  199. };
  200.  
  201. resource 'DITL' (rZoneDialog) {
  202.     {
  203.         {160, 220, 180, 280},
  204.         Button {
  205.             enabled,
  206.             "OK"
  207.         },
  208.         {20, 20, 148, 280},
  209.         UserItem {
  210.             enabled
  211.         },
  212.         {160, 220, 180, 280},
  213.         UserItem {
  214.             disabled
  215.         }
  216.     }
  217. };
  218.  
  219.  
  220. /* this ALRT and DITL are used as an error screen */
  221.  
  222. resource 'ALRT' (rUserAlert, purgeable) {
  223.     {40, 20, 180, 260},
  224.     rUserAlert,
  225.     { /* array: 4 elements */
  226.         /* [1] */
  227.         OK, visible, silent,
  228.         /* [2] */
  229.         OK, visible, silent,
  230.         /* [3] */
  231.         OK, visible, silent,
  232.         /* [4] */
  233.         OK, visible, silent
  234.     }
  235. };
  236.  
  237.  
  238. resource 'DITL' (rUserAlert, purgeable) {
  239.     { /* array DITLarray: 4 elements */
  240.         /* [1] */
  241.         {110, 150, 130, 230},
  242.         Button {
  243.             enabled,
  244.             "OK"
  245.         },
  246.         /* [2] */
  247.         {10, 60, 60, 230},
  248.         StaticText {
  249.             disabled,
  250.             "Error. ^0."
  251.         },
  252.         /* [3] */
  253.         {70, 60, 90, 230},
  254.         StaticText {
  255.             disabled,
  256.             "^1"
  257.         },
  258.         /* [4] */
  259.         {8, 8, 40, 40},
  260.         Icon {
  261.             disabled,
  262.             2
  263.         }
  264.     }
  265. };
  266.  
  267.  
  268. resource 'STR#' (sErrStrings, purgeable) {
  269.     {
  270.     "An error occurred. The error number is: ";
  271.     "You must run on 512Ke or later";
  272.     "Application Memory Size is too small";
  273.     "Not enough memory to run GetZoneList";
  274.     "An AppleTalk-related error occurred";
  275.     "There are no zones"
  276.     }
  277. };
  278.  
  279.  
  280. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  281.  
  282. resource 'SIZE' (-1) {
  283.     dontSaveScreen,
  284.     acceptSuspendResumeEvents,
  285.     enableOptionSwitch,
  286.     canBackground,                /* we can background; we don't currently, but our sleep value */
  287.                                 /* guarantees we don't hog the Mac while we are in the background */
  288.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  289.     backgroundAndForeground,    /* this is definitely note a background-only application! */
  290.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  291.     ignoreChildDiedEvents,
  292.     is32BitCompatible,
  293.     reserved,
  294.     reserved,
  295.     reserved,
  296.     reserved,
  297.     reserved,
  298.     reserved,
  299.     reserved,
  300.     kPrefSize * 1024,
  301.     kMinSize * 1024
  302. };
  303.